package com.nanhai.buddhist.college.module.study.controller.student.timetable;

import com.alibaba.nacos.common.utils.StringUtils;
import com.nanhai.buddhist.college.framework.common.pojo.CommonResult;
import com.nanhai.buddhist.college.module.collegebase.api.collegeclass.CollegeClassApi;
import com.nanhai.buddhist.college.module.collegebase.api.collegeclass.dto.ClassesRespDTO;
import com.nanhai.buddhist.college.module.collegebase.api.room.RoomApi;
import com.nanhai.buddhist.college.module.collegebase.api.room.dto.RoomRespDTO;
import com.nanhai.buddhist.college.module.collegebase.api.teacher.TeacherApi;
import com.nanhai.buddhist.college.module.collegebase.api.teacher.dto.TeacherRespDTO;
import com.nanhai.buddhist.college.module.study.controller.admin.timetable.vo.ClassTimetableRespVO;
import com.nanhai.buddhist.college.module.study.convert.timetable.ClassTimetableConvert;
import com.nanhai.buddhist.college.module.study.dal.dataobject.studysubject.StudySubjectDO;
import com.nanhai.buddhist.college.module.study.dal.dataobject.timetable.ClassTimetableDO;
import com.nanhai.buddhist.college.module.study.service.studysubject.StudySubjectService;
import com.nanhai.buddhist.college.module.study.service.timetable.ClassTimetableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.*;

import static com.nanhai.buddhist.college.framework.common.pojo.CommonResult.success;
import static com.nanhai.buddhist.college.framework.common.util.collection.CollectionUtils.*;

@Api(tags = "学生后台 - 课程")
@RestController
@RequestMapping("/study/student/class-timetable")
@Validated
public class StudentTimetableController {

    @Resource
    private ClassTimetableService classTimetableService;

    @GetMapping("/getClassTimetableListByClassId")
    @ApiOperation("查看用户课表")
    @ApiImplicitParam(name = "classId", value = "编号列表", required = true, dataTypeClass = String.class)
    public CommonResult<List<ClassTimetableRespVO>> getClassTimetableListByClassId(@RequestParam("classId") String classId) {
        List<ClassTimetableDO> list = classTimetableService.getClassTimetableListByClassId(classId);
        return success(classTimetableService.coverNames(list));
    }




}
